buf = Buffer.alloc(10);
len = buf.write("1234567890ABCDE");
console.log("写入字节数 : "+  len);//超出的不写
console.log(buf.toString());
// console.log(buf.toString('utf-8',0,len));//读取并打印

console.log('-------26个字母------');
buf = Buffer.alloc(26);
for (var i = 0 ; i < 26 ; i++) {
    buf[i] = i + 97;
}

console.log( buf.toString('ascii'));       // 输出: abcdefghijklmnopqrstuvwxyz
console.log( buf.toString('ascii',0,5));   // 输出: abcde
console.log( buf.toString('utf8',0,5));    // 输出: abcde
console.log( buf.toString(undefined,0,5)); // 使用 'utf8' 编码, 并输出: abcde